
import Home from '@/pages/home/home'
import my from '@/pages/My/my'

const inventory = r => require.ensure([], () => r(require('@/pages/inventory/inventory')))

const comInventory = r => require.ensure([], () => r(require('@/pages/com-inventory/index')))

const confirmOrder = r => require.ensure([], () => r(require('@/pages/confirm-order/index')))

const goodDetail = r => require.ensure([], () => r(require('@/pages/goods/goodDetail')))
const order = r => require.ensure([], () => r(require('@/pages/order')))
const MyCollection = r => require.ensure([], () => r(require('@/pages/My/MyCollection')))
const classify = r => require.ensure([], () => r(require('@/pages/Classify/classify')))
const OrderDetails = r => require.ensure([], () => r(require('@/pages/OrderDetails')))
const mOrderDetails = r => require.ensure([], () => r(require('@/pages/mOrderDetails')))

const address = r => require.ensure([], () => r(require('@/pages/address')))
const add_address = r => require.ensure([], () => r(require('@/pages/add_address')))

const MyMoney = r => require.ensure([], () => r(require('@/pages/MyMoney')))
const team = r => require.ensure([], () => r(require('@/pages/team')))
const setting = r => require.ensure([], () => r(require('@/pages/setting')))

const bindzfb = r => require.ensure([], () => r(require('@/pages/bindzfb')))
const PaymentPassword = r => require.ensure([], () => r(require('@/pages/PaymentPassword')))

const number = r => require.ensure([], () => r(require('@/pages/number')))
const FindShop = r => require.ensure([], () => r(require('@/pages/my/FindShop'))) //查找店铺
const FindOpenShop = r => require.ensure([], () => r(require('@/pages/my/FindOpenShop'))) //查找店铺能否开通
const entryRegister = r => require.ensure([], () => r(require('@/pages/entry/Register'))) //查找店铺

const msgIndex = r => require.ensure([], () => r(require('@/pages/msg/Index'))) //消息
const msgList = r => require.ensure([], () => r(require('@/pages/msg/List'))) //消息列表
const shouzhi = r => require.ensure([], () => r(require('@/pages/my/component/shouzhi'))) //消息列表
const orderlist = r => require.ensure([], () => r(require('@/pages/my/component/orderlist'))) //消息列表
const authorize = r => require.ensure([], () => r(require('@/pages/my/component/authorize'))) //消息列表
const set = r => require.ensure([], () => r(require('@/pages/my/component/set')))
const msgDetail = r => require.ensure([], () => r(require('@/pages/msg/Detail'))) //消息详情
import Notfound from '@/common/Notfound' //404


// 幸运转盘
const activityLuckyWheelAddress = r => require.ensure([], () => r(require('@/pages/activity/luckyWheel/Address')))//收奖品地址
const activityLuckyWheelcj = r => require.ensure([], () => r(require('@/pages/activity/luckyWheel/cj')))//九宫格的

const goodsComment = r => require.ensure([], () => r(require('@/pages/goods/Comment'))) //去评价
const goodsCommentList = r => require.ensure([], () => r(require('@/pages/goods/CommentList'))) //评价列表

// 查看所有评论
const evaluation = r => require.ensure([], () => r(require('@/pages/evaluation/index')))

// 新的抽奖数据
const Lottery = r => require.ensure([], () => r(require('@/pages/lottery/index')))

// 提现记录
const withdrawalHistory = r => require.ensure([], () => r(require('@/pages/withdrawal/index')))

// 查询列表信息
const queryInfo = r => require.ensure([], () => r(require('@/pages/queryInfo/index')))

// 设置查询
const queryLogistics = r => require.ensure([], () => r(require('@/pages/queryLogistics/index')))

// 导入结果
const importResult = r => require.ensure([], () => r(require('@/pages/importResult/index')))

// 查询快递
const courier = r => require.ensure([], () => r(require('@/pages/courier/index')))

const orderall = r => require.ensure([], () => r(require('@/pages/orderall/index')))

// 下单区
const orderarea = r => require.ensure([], () => r(require('@/pages/orderarea/index')))

// 其他
const other = r => require.ensure([], () => r(require('@/pages/other')))

// 商品详情页
const goodsdetail = r => require.ensure([], () => r(require('@/pages/orderarea/goodsdetail')))

// 填写订单
const orderwrite = r => require.ensure([], () => r(require('@/pages/orderarea/order_write')))
const chooseperson = r => require.ensure([], () => r(require('@/pages/orderarea/chooseperson')))

// 查秒杀付款快递
const killCourier = r => require.ensure([], () => r(require('@/pages/killCourier/index')))

// 商品详情页
const goodslistdetail = r => require.ensure([], () => r(require('@/pages/goodslist_detail/index')))

// 所有评论
const NewComments = r => require.ensure([], () => r(require('@/pages/all_comments/index')))

// **************************************
// 购物车
const NewShop = r => require.ensure([], () => r(require('@/pages/New/NewShop/NewShop')))

// 确认订单
const NewMakeOrder = r => require.ensure([], () => r(require('@/pages/New/NewMakeOrder/NewMakeOrder')))
// 支付
const NewPay = r => require.ensure([], () => r(require('@/pages/New/NewPay/NewPay')))
// 查看物流
const NewLogistics = r => require.ensure([], () => r(require('@/pages/New/NewLogistics/NewLogistics')))
// 支付结果
const NewPayResult = r => require.ensure([], () => r(require('@/pages/New/NewPayResult/NewPayResult')))
// 订单列表
const NewOrder = r => require.ensure([], () => r(require('@/pages/New/NewOrder/NewOrder')))
// 订单详情
const NewOrderDetail = r => require.ensure([], () => r(require('@/pages/New/NewOrderDetail/NewOrderDetail')))
// 评价
const NewEvaluation = r => require.ensure([], () => r(require('@/pages/New/NewEvaluation/NewEvaluation')))

// 商品列表数据
const NewProList = r => require.ensure([], () => r(require('@/pages/New/NewProList/NewProList')))

// 无权限页面
const NewAuthority = r => require.ensure([], () => r(require('@/pages/New/NewAuthority/NewAuthority')))
// 福利区
const NewWelfare = r => require.ensure([], () => r(require('@/pages/New/NewWelfare/NewWelfare')))
// 新版团队
const NewTeam = r => require.ensure([], () => r(require('@/pages/New/NewTeam/NewTeam')))
// 跳转到不是微信客户端的提示
const NewWechat = r => require.ensure([], () => r(require('@/pages/New/NewWechat/NewWechat')))
// 认证资料
const NewAudit =  r => require.ensure([], () => r(require('@/pages/New/NewAudit/NewAudit')))

import newRouter from './modules/new'
import pingtuanRouter from './modules/pingtuan'
import partnerRouter from './modules/partner'

export default new VueRouter({
  mode: 'history',
  routes: [
    {
      path: '*',
      component: Notfound
    },
    ...newRouter,
    ...pingtuanRouter,
    ...partnerRouter,
    { path: '/NewWechat', name: 'NewWechat', component: NewWechat },
    { path: '/', name: 'Home', component: Home, redirect: '/home' },
    { path: '/Home', name: 'Home', component: Home, meta: { index: 1 } },
    { path: '/my', name: 'my', component: my },
    { path: '/goodslist_detail', name: 'goodslist_detail', component: goodslistdetail },
    // 外包路由 start

    { path: '/NewShop', name: 'NewShop', component: NewShop },
    { path: '/NewMakeOrder', name: 'NewMakeOrder', component: NewMakeOrder },
    { path: '/NewPay', name: 'NewPay', component: NewPay },
    { path: '/NewLogistics', name: 'NewLogistics', component: NewLogistics },
    { path: '/NewPayResult', name: 'NewPayResult', component: NewPayResult },
    { path: '/NewOrder', name: 'NewOrder', component: NewOrder },
    { path: '/NewOrderDetail', name: 'NewOrderDetail', component: NewOrderDetail },
    { path: '/NewEvaluation', name: 'NewEvaluation', component: NewEvaluation },
    { path: '/NewProList', name: 'NewProList', component: NewProList },
    { path: '/NewComments', name: 'NewComments', component: NewComments },
    {path: '/NewAuthority', name: 'NewAuthority', component: NewAuthority },
    {path: '/NewWelfare', name: 'NewWelfare', component: NewWelfare },
    {path: '/NewTeam', name: 'NewTeam', component: NewTeam },
    {path: '/NewAudit', name: 'NewAudit', component: NewAudit },
    // 外包路由 end
    {
      path: '/goodDetail',
      name: 'goodDetail',
      component: goodDetail,
      meta: { index: 0 }
    },

    {
      path: '/inventory',
      name: 'inventory',
      component: inventory,
      meta: { index: 0 }
    },
    {
      path: '/comInventory',
      name: 'comInventory',
      component: comInventory,
      meta: { index: 0 }
    },
    {
      path: '/confirmOrder',
      name: 'confirmOrder',
      component: confirmOrder,
      meta: { index: 0 }
    },
    { path: '/withdrawalHistory', name: 'withdrawalHistory', component: withdrawalHistory },
    { path: '/queryInfo', name: 'queryInfo', component: queryInfo },
    { path: '/queryLogistics', name: 'queryLogistics', component: queryLogistics },
    { path: '/importResult', name: 'importResult', component: importResult },
    { path: '/courier', name: 'courier', component: courier },
    { path: '/evaluation', name: 'evaluation', component: evaluation },
    { path: '/lottery', name: 'lottery', component: Lottery },
    {
      path: '/order',
      name: 'order',
      component: order,
      children: [
        {
          path: '/order/OrderDetails',
          name: '/order/OrderDetails',
          component: OrderDetails,
        }
      ]
    },
    { path: '/MyCollection', name: 'MyCollection', component: MyCollection },
    { path: '/classify', name: 'classify', component: classify },
    { path: '/OrderDetails', name: 'OrderDetails', component: OrderDetails },
    { path: '/mOrderDetails', name: 'mOrderDetails', component: mOrderDetails },

    {
      path: '/address',
      name: 'address',
      component: address
    },
    {
      path: '/add_address',
      name: 'add_address',
      component: add_address
    },
    {
      path: '/MyMoney',
      name: 'MyMoney',
      component: MyMoney
    },
    {
      path: '/team',
      name: 'team',
      component: team
    },
    {
      path: '/setting',
      name: 'setting',
      component: setting
    },
    {
      path: '/bindzfb',
      name: 'bindzfb',
      component: bindzfb
    },
    {
      path: '/PaymentPassword',
      name: 'PaymentPassword',
      component: PaymentPassword
    },
    {
      path: '/number',
      name: 'number',
      component: number
    },
    {
      path: '/findshop',
      component: FindShop
    },
    {
      path: '/FindOpenShop',
      component: FindOpenShop
    },
    {
      path: '/entry/register',
      name: 'register',
      component: entryRegister
    },
    {
      path: '/msg',
      component: msgIndex
    },
    {
      path: '/msg/list',
      name: msgList,
      component: msgList
    },
    {
      path: '/msg/detail',
      component: msgDetail
    },

    {
      path: '/activity/luckyWheel/address',
      component: activityLuckyWheelAddress
    },
    {
      path: '/activity/luckyWheel/cj',
      component: activityLuckyWheelcj
    },
    {
      path: '/goods/comment',
      component: goodsComment
    },
    {
      path: '/goods/commentList',
      component: goodsCommentList
    },
    {
      path: '/shouzhi',
      component: shouzhi
    },
    {
      path: '/orderlist',
      component: orderlist
    },
    {
      path: '/authorize',
      component: authorize
    }
    ,
    {
      path: '/set',
      component: set
    },
    {
      path: '/orderall',
      name: 'orderall',
      component: orderall
    },
    {
      path: '/orderarea',
      name: 'orderarea',
      component: orderarea
    },
    {
      path: '/other',
      name: 'other',
      component: other
    },
    {
      path: '/goodsdetail',
      name: 'goodsdetail',
      component: goodsdetail
    },
    {
      path: '/order_write',
      name: 'order_write',
      component: orderwrite
    },
    {
      path: '/chooseperson',
      name: 'chooseperson',
      component: chooseperson
    },
    {
      path: '/killCourier',
      name: 'killCourier',
      component: killCourier
    }
  ],
  //路由切换页面始终回到最顶部
  // scrollBehavior(to, from, savedPosition) {
  //   return { x: 0, y: 0 }
  // }
})
